<template>
    <section class="mobildParent">
        <div class="mobildBox">
            <div class="mobileUserInfo">
                <div class="mobileUserImg"  v-if="userInfo">
                    <img :src="userInfo.avatar" alt="">
                </div>
                <p class="mobileUserTitle"  v-if="userInfo">
                    {{userInfo.name}}
                </p>
                <p class="mobileUserVip">
                    给你赠送了7天VIP
                </p>
                <div class="mobileLine"></div>
                <p class="mobileRecommend">推荐一个超棒室内设计素材网站给你</p>
                <p class="mobileRecommend">集设网www.jishe.com</p>
                <p class="mobileGive">注册领取VIP</p>
                
            </div>
            <div class="computer">
                    请在电脑上参加活动
                </div>
        </div>
    </section>
</template>
<script>
import {mapState,mapMutations,mapGetters,mapActions} from 'vuex';
export default {
    data(){
        return{
            userInfo:null,//用户信息
        }
    },
    created(){
        $('#app').css({
            'width':'7.5rem',
            'height':'13.33rem',
            'overflow':'hidden'
        });
        $(".side,.goTopIcon").css('display','none'); 
            axios.get('/shareUser/'+this.$route.query.onlycode).then(response=>{
                this.userInfo = response.data;
            })
        
    },
    mounted () {
        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
            // alert('移动端')
            this.WXConfig.wxShowMenu(); 
        }
    },
    beforeCreate () {
        if(/from/i.test(window.location.href)){
            this.$router.push('/mobile?onlycode='+this.$route.query.onlycode);
        }
        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
            // alert('移动端')
        }else if(window.localStorage.getItem('jwt_token')){
            this.$router.push('/share')
        }else {
            this.$router.push('/shareLogin?onlycode='+this.$route.query.onlycode)
        };
        
    },
    computed: {
        ...mapState({//登录的用户信息
            user: state => state.AuthUser
        }),
        mismatchError() {
            return this.bag.has('password:auth') && !this.errors.has('password')
        },
    },
}
</script>

<style>
    .mobildParent{
        height: 13.33rem;
    }
    .mobildBox{
        position: relative;
        top:0;
        left: 0;
        width: 7.5rem;
        height: 13.33rem;
        background:url(./img/mobile1.png) no-repeat;
        background-size: cover;
        z-index:999;
    }
    .mobileUserInfo{
        width: 6.16rem;
        height: 4.32rem;
        border-radius: 0.06rem;
        background:rgba(255,255,255,.8);
        position: absolute;
        top: 5.32rem;
        left:0.77rem;
        box-shadow: 0 0 20px hsla(3,100%,79%,.4);
        text-align: center;
        padding-top: 0.3rem;
    }
    .mobileUserImg img{
        display:inline-block;
        width: 1.29rem;
        height: 1.29rem;
        border-radius: 50%;
    }
    .mobileUserTitle{
        font-size: 0.26rem;
        line-height: 0.4rem;
        color: #694c49;
    }
    .mobileUserVip{
        font-size: 0.3rem;
        line-height: 0.64rem;
        color: #e5261f;
        letter-spacing: 0.02rem;
    }
    .mobileLine{
        width: 1.3rem;
        border-top: 0.03rem solid #db8292;
        margin: 0.02rem auto 0.31145rem;
    }
    .mobileRecommend,.mobileGive{    
        font-size: 0.27rem;
        line-height: 0.434rem;
        color: #494a49;
    }
    .mobileGive{
        color: #eb5c57;
    }
    .computer{
        width: 100%;
        text-align: center;
        font-size: 0.3rem;
        line-height: 0.5rem;
        color: #feaea1;
        letter-spacing: 0.021rem;
        position: absolute;
        bottom: 1.65rem;

    }
</style>